Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #4153: Handling OpenAI 429's gracefully #4284

Merged
merged 3 commits into from
Dec 11, 2024
Merged

Conversation

vga91
Copy link
Collaborator

@vga91 vga91 commented Dec 10, 2024

Fixes #4153

Adds a backoff strategy to OpenAI API calls.
To better handle API failures caused by excessive load (HTTP 429 - Too Many Requests), the OpenAI API calls have been wrapped in a method that implements a backoff strategy.
This approach efficiently manages retries, reducing the likelihood of overwhelming the API and enhancing system resilience under high-load conditions.

Changes

  • added ExtendedUtil.withBackOffRetries which retries the Supplier passed after a while
  • added withBackOffRetries tests
  • added configs exponential, backOffRetry and retries

@vga91 vga91 marked this pull request as draft December 10, 2024 12:17
@vga91 vga91 marked this pull request as ready for review December 11, 2024 13:57
@RobertoSannino RobertoSannino merged commit 5da8113 into dev Dec 11, 2024
5 checks passed
@RobertoSannino RobertoSannino deleted the issue-4153 branch December 11, 2024 16:11
vga91 added a commit that referenced this pull request Dec 11, 2024
* Fixes #4153: Handling OpenAI 429's gracefully

* cleanup

* fix tests
vga91 added a commit that referenced this pull request Dec 11, 2024
* Fixes #4153: Handling OpenAI 429's gracefully

* cleanup

* fix tests
vga91 added a commit to vga91/neo4j-apoc-procedures that referenced this pull request Jan 16, 2025
vga91 added a commit that referenced this pull request Jan 16, 2025
* Fixes #4153: Handling OpenAI 429's gracefully

* cleanup

* fix tests
vga91 added a commit that referenced this pull request Jan 16, 2025
* Fixes #4153: Handling OpenAI 429's gracefully

* cleanup

* fix tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants